/** 
 * Copyright 2014 whj All Rights Reserved.
 * 项目名：codegnrt
 * 包名：com.whj.code.dao.mybatis
 * 文件名：MybatisXMLMapperGenerator.java 
 * 日期：2014-11-25 10:21
 */
package com.whj.code.dao.mybatis;

import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.codegen.mybatis3.xmlmapper.XMLMapperGenerator;
import org.mybatis.generator.codegen.mybatis3.xmlmapper.elements.AbstractXmlElementGenerator;
import org.mybatis.generator.codegen.mybatis3.xmlmapper.elements.SelectByPrimaryKeyElementGenerator;

/**
 * 生成xml.
 * @author wanghj
 *
 */
public class MybatisXMLMapperGenerator extends XMLMapperGenerator{
    public MybatisXMLMapperGenerator() {
        super();
    }

    @Override
    protected void addSelectByPrimaryKeyElement(XmlElement parentElement) {
        AbstractXmlElementGenerator elementGenerator = new SelectByPrimaryKeyElementGenerator();
        initializeAndExecuteGenerator(elementGenerator, parentElement);
    }

    protected void addInsertSelectiveElement(XmlElement parentElement) {

    }

    protected void addUpdateByPrimaryKeySelectiveElement(
            XmlElement parentElement) {
    
    }

    protected void addUpdateByPrimaryKeyWithoutBLOBsElement(
            XmlElement parentElement) {
        AbstractXmlElementGenerator elementGenerator = new MybatisUpdateByPrimaryKeyWithoutBLOBsElementGenerator();
        initializeAndExecuteGenerator(elementGenerator, parentElement);
    }

    protected void addInsertElement(XmlElement parentElement) {
        AbstractXmlElementGenerator elementGenerator = new MybatisInsertSelectiveElementGenerator();
        initializeAndExecuteGenerator(elementGenerator, parentElement);
    }

    protected void addDeleteByPrimaryKeyElement(XmlElement parentElement) {
        AbstractXmlElementGenerator elementGenerator = new MybatisDeleteByPrimaryKeyElementGenerator();
        initializeAndExecuteGenerator(elementGenerator, parentElement);
    }
}
